<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'selectuser.jsp' starting page</title>
    
	<script type="text/javascript" src="<%=path%>/commonjs/jquery-1.7.1.js"></script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		td {border: 1px solid black;}
	</style>


  </head>
  
  <body>
  <table style="border: 1px solid;">
    	<thead>全部发布信息如下：
    	
    	</thead>
    	<tbody id="goodinfo" style="border: 1px solid;">
    	<tr>
    	
    	<td>供求关系</td>
    	<td>标题</td>
    	<td>分类</td>
    	
    	<td>转让价格</td>
    	<td>物品描述</td>
    	<td>联系人电话号码</td>
    	<td>联系人姓名</td>
    	<td>发布时间</td>
    	<td>操作</td>
    	
    	
    	</tr>
    	
    	</tbody>
    </table>0
   
    <script type="text/javascript">
    	$.post('<%=path%>/json/selectgoods.action',
    		{},
    		function(data){
    			for(var i=0;i<data.goods.length;i++){
    				var result='<tr><td>'+
    					data.goods[i].supplyordemand+"&nbsp;</td><td>"+
    					data.goods[i].title+"&nbsp;</td><td>"+data.goods[i].classify+"&nbsp;&nbsp;&nbsp;</td><td>"+data.goods[i].price+"</td><td>"+data.goods[i].description+"&nbsp;&nbsp;&nbsp;</td><td>"+data.goods[i].telephone+"&nbsp;&nbsp;&nbsp;</td><td>"+data.goods[i].contactname+"&nbsp;</td><td>"+data.goods[i].publishTime+"&nbsp;&nbsp;&nbsp;</td><td>";
    			result=result+'<input type="button"  value="删除" onclick="deletegoods('+data.goods[i].id+');"/>';
    			result=result+'<input type="button"  value="修改" onclick="modifygoods('+data.goods[i].id+');"/>';
    				result=result+'</td></tr>';
    				$(result).appendTo("#goodinfo" );
    			}
    		},
    		'json');
    	
    	function  deletegoods(goodsid)
{ 
   window.location.href="deletegoods.action?goodsid="+goodsid;

}
function  modifygoods(goodsid)
{ 

   window.location.href="modifygoods.action?goodsid="+goodsid;

}
    </script>
    
  </body>
</html>
